<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>美兰数据文化馆与图书馆</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
    <style>
        .layui-table th {
            font-size: 16px;
            font-weight: 600;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <table lay-filter="flowMeterLists" class="layui-table"
                   lay-data="{url:'<%=request.getContextPath()%>/rest/reporting/flowMeterList',defaultToolbar: ['filter','print'], cellMinWidth: 80, page:false,toolbar: '#flowMeterListExports',height: 'full-70',totalRow:true}">
                <thead>
                <tr>
                    <th lay-data="{align:'center'}" colspan="5">物资出入库流水表</th>
                </tr>
                <tr>
                    <th lay-data="{field:'epcCode',align: 'center',width:'20%',totalRowText: '合计'}">EPC标签</th>
                    <th lay-data="{field:'productName',align: 'center',width:'20%'}">物资名称</th>
                    <th lay-data="{field:'type',align: 'center',width:'20%',templet:'#type'}">出入状态</th>
                    <th lay-data="{field:'createTime',align: 'center',width:'20%'}">出入时间</th>
                    <th lay-data="{field:'number',align: 'center',width:'20%',totalRow: true}">出入计量</th>
                </tr>
                </thead>
            </table>

        </div>
    </div>
</div>

<script type="text/html" id="type">
    {{#  if(d.type== '入库'){}}

    <a class="layui-btn layui-btn-primary layui-btn-xs"> {{ d.type }}</a>

    {{#  } else {}}

    <a class="layui-btn layui-btn-xs"> {{ d.type }}</a>

    {{#  } }}
</script>

<script type="text/html" id="flowMeterListExports">
    <div class="layui-inline" lay-event="exports" title="导出">
        <i class="layui-icon layui-icon-export"></i>
    </div>
</script>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script>
    layui.use(['table'], function () {
        var $ = layui.$
            , table = layui.table;

        //监听头工具栏事件
        table.on('toolbar(flowMeterLists)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id)
                , data = checkStatus.data;//获取选中的数据
            switch (obj.event) {
                case 'exports':
                    exports(data);
                    break;
            }
            ;
        });

        function exports(data) {
            var url = "<%=request.getContextPath()%>/rest/reporting/flowMeterExcel?typename=物资出入库流水表";
            window.open(url);
        }
    });
</script>
</body>
</html>